package com.yh.correct.service.impl;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yh.correct.dao.IBonusPointsMapper;
import com.yh.correct.model.BonusPoints;
import com.yh.correct.model.Page;
import com.yh.correct.service.IBonusPointsService;

/** 
* @author 刘文涛  E-mail: 894516860@qq.com
* @version 创建时间：2017年3月7日 下午 3:38:36
* 加分扣分记录业务层接口实现类
*/
@Service("bonusPointsService")
public class BonusPointsServiceImpl implements IBonusPointsService {
	
	@Autowired
	private IBonusPointsMapper bonusPointsMapper;
	
	@Override
	public Page getLikeBonusPoints(Map<String, Object> condition) {
		Page page=new Page();
		page.setTotalNum(bonusPointsMapper.getLikeBonusPointsCount(condition));
		int pageSize = Integer.parseInt(String.valueOf(condition.get("pageSize")));
		page.setPageSize(pageSize);
		int curPageNum = Integer.parseInt(String.valueOf(condition.get("pageNum")));
		page.setCurPageNum(curPageNum);
		page.setTotalPage(page.getTotalNum()/pageSize+(page.getTotalNum()%pageSize==0?0:1));
		page.setResult(bonusPointsMapper.getLikeBonusPoints(condition));
		return page;
	}

	@Override
	public int addBonusPoints(BonusPoints bonuspoints) {
		return bonusPointsMapper.addBonusPoints(bonuspoints);
	}

	@Override
	public int delBonusPoints(BonusPoints bonuspoints) {
		return bonusPointsMapper.delBonusPoints(bonuspoints);
	}

	@Override
	public int updateBonusPoints(BonusPoints bonuspoints) {
		// TODO 自动生成的方法存根
		return bonusPointsMapper.updateBonusPoints(bonuspoints);
	}

	@Override
	public Map<String, Object> getBonusPointsById(BonusPoints bonuspoints) {
		// TODO 自动生成的方法存根
		return bonusPointsMapper.getBonusPointsById(bonuspoints);
	}

	@Override
	public List<Map<String, Object>> getAllBonusPoints() {
		// TODO 自动生成的方法存根
		return bonusPointsMapper.getAllBonusPoints();
	}

}
